package com.swt.controller.T_controller;

import com.alibaba.fastjson.JSON;
import com.swt.domain.Club;
import com.swt.domain.User;
import com.swt.domain.Vipcard;
import com.swt.service.T_service.VipStaffService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Controller
public class VipStaffController {
    @Resource(name = "TVipService")
    private VipStaffService vipStaffService;
//
    @RequestMapping("/TVipstaffQuery")
    @ResponseBody
    public String queryVip(int page, String quert, HttpServletRequest httpServletRequest){

        Club club = (Club) httpServletRequest.getSession().getAttribute("CLUB_SESSION_KEY");
        int clubClubId = club.getClubId();
        List<User> vipcardList = vipStaffService.queryService(page,quert,clubClubId);

        return JSON.toJSONString(vipcardList);
    }
    //通过会员id查询拥有的卡
    @RequestMapping("/TqueryVipCard")
    @ResponseBody
    public String queryVipCard(int vipId){

        List<Vipcard> vipcardList1 = vipStaffService.queryVipCardService(vipId);
      return JSON.toJSONString(vipcardList1);

    }


    public VipStaffService getVipStaffService() {
        return vipStaffService;
    }

    public void setVipStaffService(VipStaffService vipStaffService) {
        this.vipStaffService = vipStaffService;
    }
}
